<?php
// +----------------------------------------------------------------------
//            -------------------------
//           /   / ----------------\  \
//          /   /             \  \
//         /   /              /  /
//        /   /    /-------------- /  /
//       /   /    /-------------------\  \
//      /   /                   \  \
//     /   /                     \  \
//    /   /                      /  /
//   /   /      /----------------------- /  /
//  /-----/      /---------------------------/
// +----------------------------------------------------------------------
// | Copyright (c) 2016 http://baimifan.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: Sage 2016/4/22  16:46
// +----------------------------------------------------------------------
namespace Admin\Controller;


class CardModifyController extends CashierBaseController{

    function index(){
        $this->display();
    }

    function doModify(){
        $data=I("post.");
        $card_id=$data['card_id'];
        unset($data['card_id']);
        $Card=M("Card");
        $Card->startTrans();
        $c=$Card->where(["card_id"=>$card_id])->count();
        if($c<1){
            $this->error("此卡不存在");
        }

        $r=$Card->where(["card_id"=>$card_id])->data($data)->save();
        if($r){
            $Card->commit();
            $this->success("修改成功",U("index"));
        }else{
            $Card->rollback();
            $this->error("修改失败或未修改任何信息");
        }
    }

}